﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="mis_function_user_log_detail.aspx.cs" Inherits="mis_function_user_log_detail" %>

<%@ PreviousPageType VirtualPath="~/Management/System/mis_function_user_log.aspx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="Server">
  <div>
    <asp:Button ID="btn_export" runat="server" Text="畫面匯出" OnClick="btn_export_Click" />
    <asp:Button ID="btn_exit" runat="server" Text="離開" OnClick="btn_exit_Click" />
   
    <asp:Panel ID="PanelMain" runat="server">
      <table class="ConditionTable">
        <th colspan="4">系統使用紀錄明細
        </th>
        <tr>
          <td>年月 :
                    <asp:Label ID="lbl_YearMonth" runat="server" />
            <asp:Label ID="lbl_LOGIN_DATE" runat="server" Visible="false" />
          </td>
          <td>選單功能 :
                    <asp:Label ID="lbl_FUNCTION_NAME" runat="server" />
            <asp:Label ID="lbl_FUNCTION_ID" runat="server" Visible="false" />
          </td>
          <td>單位 :
                    <asp:Label ID="lbl_dept" runat="server" />
          </td>
          <td>使用者 :
                    <asp:Label ID="lbl_user" runat="server" />
            <asp:Label ID="lbl_USER_ID" runat="server" Visible="false" />
          </td>
        </tr>
        <tr>
          <td colspan="4"></td>
        </tr>
      </table>
      <br />
      <asp:GridView ID="gv_login_log" runat="server" AllowPaging="True"
        AutoGenerateColumns="False" DataSourceID="SDS_MIS_FUNCTION_USER_LOG" OnRowDataBound="gv_login_log_RowDataBound">
        <Columns>
          <asp:TemplateField HeaderText="日期" SortExpression="LOGIN_DATE">
            <ItemTemplate>
              <asp:Label ID="lbl_LOGIN_DATE" runat="server" Text='<%# Bind("LOGIN_DATE") %>'></asp:Label>
            </ItemTemplate>
          </asp:TemplateField>
          <%--<asp:BoundField DataField="FUNCTION_ID" HeaderText="選單功能" SortExpression="FUNCTION_ID" />--%>
          <asp:BoundField DataField="LOGIN_COUNTER" HeaderText="次數" SortExpression="LOGIN_COUNTER" />
        </Columns>
      </asp:GridView>
      <asp:SqlDataSource ID="SDS_MIS_FUNCTION_USER_LOG" runat="server"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
        SelectCommand="SELECT FUNCTION_ID,USER_ID, LOGIN_DATE , COUNT(USER_ID) AS LOGIN_COUNTER 
FROM MIS_FUNCTION_USER_LOG
WHERE FUNCTION_ID = :FUNCTION_ID AND USER_ID = :USER_ID AND SUBSTR(LOGIN_DATE,0,6) = :LOGIN_DATE
GROUP BY FUNCTION_ID,USER_ID ,LOGIN_DATE ">
        <SelectParameters>
          <asp:ControlParameter ControlID="lbl_FUNCTION_ID" Name="FUNCTION_ID" PropertyName="Text" Type="String" />
          <asp:ControlParameter ControlID="lbl_USER_ID" Name="USER_ID" PropertyName="Text" Type="String" />
          <asp:ControlParameter ControlID="lbl_LOGIN_DATE" Name="LOGIN_DATE" PropertyName="Text" Type="String" />
        </SelectParameters>
      </asp:SqlDataSource>
    </asp:Panel>
  </div>

</asp:Content>

